package org.zpp.springboot.rabbitmq;

import java.io.IOException;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.zpp.springboot.rabbitmq.common.Constants;

import com.rabbitmq.client.Channel;

@Component
public class ConsumeService {
	
	@RabbitListener(queues = Constants.QUEUE, containerFactory="rabbitListenerContainerFactory")
	@RabbitHandler
    public void process(Message message,Channel channel) throws IOException {
		System.out.println("接收到的消息："+new String(message.getBody()));
    }
}
